Skip to content

safe observability integrations#127

Merged
vishalanandl177 merged 2 commits into
mainfrom
SCRUM-10-P0-Add-safe-observability-integrations
Jul 4, 2026
Merged

safe observability integrations#127
vishalanandl177 merged 2 commits into
mainfrom
SCRUM-10-P0-Add-safe-observability-integrations

Conversation

@vishalanandl177

Copy link
Copy Markdown
Owner

No description provided.

@vishalanandl177 vishalanandl177 changed the title Scrum 10 p0 add safe observability integrations safe observability integrations Jul 4, 2026
@vishalanandl177
vishalanandl177 merged commit 2847d50 into main Jul 4, 2026
6 checks passed
@vishalanandl177
vishalanandl177 deleted the SCRUM-10-P0-Add-safe-observability-integrations branch July 4, 2026 11:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a55066792c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +68 to +72
if key == "method":
value = event.get("method")
else:
value = low_cardinality.get(key)
labels[key] = _safe_label_value(value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bucket unrecognized HTTP methods before labeling

When DRF_API_LOGGER_METHODS is not configured, event["method"] is the client-supplied request.method; sending random method tokens such as FOO123 will produce a new Prometheus time series for each token because this value is used verbatim as the method label. That undermines the safe low-cardinality guarantee for record_prometheus_metrics; whitelist standard methods or collapse unknown values before putting them in labels.

Useful? React with 👍 / 👎.

scope = sentry_sdk.Scope.get_current_scope()
configure_sentry_scope(scope, kwargs)

API_LOGGER_SIGNAL.listen += enrich_sentry_scope

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move Sentry enrichment before error capture

When users wire the Sentry helper exactly as this recipe shows, it will miss the errors it is supposed to annotate: APILoggerMiddleware emits API_LOGGER_SIGNAL only after self.get_response(request) returns, and an exception raised by the view either has already been captured by Sentry or prevents the signal from being emitted at all. In those error paths the tags/context from configure_sentry_scope are absent, so the recipe should use Sentry's request scope, before_send, or middleware before the view is invoked instead of the logger signal.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant